#pragma once
#include "GL/glew.h"
#include "Uniform.h"
#include <string>
#include <map>
class GLSLShader
{
public:
	/**
	* Creates a new GLSLShader with the provide file locations
	* of the shader.
	*/
	GLSLShader(std::wstring vertexShader, std::wstring fragmentShader);
	/**
	* Destroys the GLSLShader.
	*/
	virtual ~GLSLShader(void);
	/**
	* Initialize the GLSL shader. This call can only be performed
	* if a valid OpenGL current context.
	*/
	void Init();
	/**
	* Activates the current shader.
	*/ 
	void Activate();
	void Deactivate();
	/**
	* Transfers the transform to the shader.
	*/
	void SetTransforms();
	

	/**
	* Update the variables of the shades.
	*/
	virtual void UpdateVariables()=0;
	/**
	* Query the uniform locations.
	*/
	virtual void CreateVariables()=0;
	/**
	* Gets 
	*/ 
	Uniform& GetUniformVariable(std::string name);
	void AddUniformVariable(std::string name);

	GLint GetProgramID(){
		return m_ProgramID;
	}

	
private:
	/**
	* Reads the contents of a file as ASCII.
	* @param fileName the name of the file.
	* @return the contents of the file.
	*/
	std::string ReadAsciiFile(std::wstring fileName);
	/**
	* The location of the vertex shader.
	*/
	std::wstring m_VertexShader;
	/**
	* The location of the fragment shader
	*/
	std::wstring m_FragmentShader;
	/**
	* The OpenGL vertex shader id
	*/
	GLuint m_VertexShaderID;
	/**
	* The OpenGL fragment shader id
	*/
	GLuint m_FragmentShaderID;
	/**
	* The id for the shader program.
	*/
	GLuint m_ProgramID;
	/**
	* map that links a variable name to a uniform parameter in the shader.
	*/
	std::map<std::string,Uniform*> m_VariableMap;

	Uniform* m_ProjectionTransform;
	Uniform* m_WorldViewTransform;

	GLuint m_TransformBlockID;
};

